﻿using UnityEngine;
using Unity.Entities;
using System;

namespace Jinndev.Rendering2D {

    [Serializable]
    [MaximumChunkCapacity(256)]
    public struct CustomRenderer : ISharedComponentData, IEquatable<CustomRenderer> {

        public Mesh mesh;
        public Material material;

        public bool Equals(CustomRenderer other) {
            return other.mesh == mesh && other.material == material;
        }

        public override int GetHashCode() {
            int hash = 0;
            if (!ReferenceEquals(mesh, null)) {
                hash ^= mesh.GetHashCode();
            }
            if (!ReferenceEquals(material, null)) {
                hash ^= material.GetHashCode();
            }
            return hash;
        }

    }

    

}
